/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
$(function(){
    
    $("#save-btn").click(function(){
        var items = $("input[name=checkbox1]:checked");
        var flag = false;
        var kcbh = null;
        var hphm = null;
        if(items.length==0){
		flag = true;
	}else{
		$("input[name=checkbox1]:checked").each(function(){
			if(kcbh==null){
				kcbh=$(this).val().split("-")[0];
                                hphm=$(this).val().split("-")[1];
			}else{
				kcbh+=","+$(this).val().split("-")[0];
				hphm+=","+$(this).val().split("-")[1];
			}
		});
	}
        if(flag){
            $.alert('请至少选择一条数据！');
        }else{
            var o = new AjaxOptions();
            o.put('service_code','P90005');
            o.put('kcbh',kcbh);
            o.put('hphm',hphm);
            o.put('bgrzb',$('#bgrzb').val());
            o.put('bgrip',$('#bgrip').val());
            o.put('bgr_userid',$('#bgr_userid').val());
            o.put('bgrname',$('#bgrname').val());
            o.sus=function(data){
                var sj = Math.random();
                $.toast("操作成功");
                window.location.href=window.location.href+sj;
                
            };
            o.fal = function (code,desc){
                if(code=="400000"){
                    $.alert('移交车辆数据出现异常!');
                }
            };
            $.ajax(o);
        }
    });
    
});

